I am trying to make a Tampermonkey userscript that needs to override a global variable that is defined in a small script in a <script>
element in the HTML. This variable controls another, bigger script.
It seems that when the page loads, the global variable is first defined from the script in the HTML for a quick moment before the userscript defines it, and the big script loads after the HTML script but before the userscript. I need to have the big script load after the variable is defined to my desired value by my userscript, or it won't work.
Copyright Notice:Content Author:「Lamp」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/40901296/override-a-global-variable-defined-in-script-tags-using-a-userscript